package com.lcm.learn.lcmcode.lock;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @description:
 * @author: lcm
 * @create: 2019-12-18 16:46
 **/

public class LockTest {

    public static void main(String[] args){
        ReentrantLock lock=new ReentrantLock();
        Condition notNull = lock.newCondition();
        Condition notFull = lock.newCondition();

        try {
            notFull.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        notFull.signalAll();


        lock.lock();
        try {
            //业务
        }finally {
            lock.unlock();
        }
    }

}
